home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / emacs / emacs1857 / src_d2.zoo / source / cm.h < prev    next >
C/C++ Source or Header  |  1991-12-02  |  3KB  |  101 lines

  1. /* Cursor motion calculation definitions for GNU Emacs
  2.    Copyright (C) 1985 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU Emacs.
  5.  
  6. GNU Emacs is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GNU Emacs is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU Emacs; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. /* This structure holds everything needed to do cursor motion except the pad
  22.    character (PC) and the output speed of the terminal (ospeed), which
  23.    termcap wants in global variables. */
  24.  
  25. extern struct cm {
  26.     /* Cursor position */
  27.     int    cm_curY,    /* current row */
  28.         cm_curX;    /* current column */
  29.                 /* -1 in either one means position unknown */
  30.     /* Capabilities from termcap(5) (including extensions) */
  31.     char    *cm_up,        /* up (up) */
  32.         *cm_down,    /* down (do) */
  33.         *cm_left,    /* left (bs) */
  34.         *cm_right,    /* right (nd) */
  35.         *cm_home,    /* home (ho) */
  36.         *cm_cr,        /* carriage return (cr) */
  37.         *cm_ll,        /* last line (ll) */
  38.         *cm_abs,    /* absolute (cm) */
  39.         *cm_habs,    /* horizontal absolute (ch) */
  40.         *cm_vabs,    /* vertical absolute (cv) */
  41.         *cm_ds,        /* "don't send" string (ds) */
  42.         *cm_tab;    /* tab (ta) */
  43.     int    cm_tabwidth,    /* tab width (tw) */
  44.         cm_cols,    /* Number of cols on screen (co) */
  45.         cm_rows;    /* Number of rows on screen (li) */
  46.     unsigned int
  47.         cm_autowrap:1,    /* autowrap flag (am) */
  48.         cm_magicwrap:1,    /* vt100s: cursor stays in last col but
  49.                    will wrap if next char is printing (xn) */
  50.         cm_usetabs:1,    /* if set, use tabs */
  51.         cm_autolf:1,    /* \r performs a \r\n (rn) */
  52.         cm_losewrap:1;  /* if reach right margin, forget cursor location */
  53.     /* Costs */
  54.     int    cc_up,        /* cost for up */
  55.         cc_down,    /* etc */
  56.         cc_left,
  57.         cc_right,
  58.         cc_home,
  59.         cc_cr,
  60.         cc_ll,
  61.         cc_abs,        /* abs costs are actually min costs */
  62.         cc_habs,
  63.         cc_vabs,
  64.         cc_tab;
  65. } Wcm;
  66.  
  67. extern char PC;            /* Pad character */
  68. extern short ospeed;        /* Output speed (from sg_ospeed) */
  69.  
  70. /* Shorthand */
  71. #ifndef NoCMShortHand
  72. #define    curY        Wcm.cm_curY
  73. #define    curX        Wcm.cm_curX
  74. #define    Up        Wcm.cm_up
  75. #define    Down        Wcm.cm_down
  76. #define    Left        Wcm.cm_left
  77. #define    Right        Wcm.cm_right
  78. #define    Home        Wcm.cm_home
  79. #define    CR        Wcm.cm_cr
  80. #define    LastLine    Wcm.cm_ll
  81. #define    TabWidth    Wcm.cm_tabwidth
  82. #define    DontSend    Wcm.cm_ds
  83. #define    AbsPosition    Wcm.cm_abs
  84. #define    ColPosition    Wcm.cm_habs
  85. #define    RowPosition    Wcm.cm_vabs
  86. #define    AutoWrap    Wcm.cm_autowrap
  87. #define    MagicWrap    Wcm.cm_magicwrap
  88. #define    UseTabs        Wcm.cm_usetabs
  89. #define    AutoLF        Wcm.cm_autolf
  90. #define    ScreenRows    Wcm.cm_rows
  91. #define    ScreenCols    Wcm.cm_cols
  92.  
  93. #define    cmat(row,col)    (curY = (row), curX = (col))
  94. #define    cmplus(n)    {if ((curX += (n)) >= ScreenCols && !MagicWrap)\
  95.                {if (Wcm.cm_losewrap) curY = -1; \
  96.                   else if (AutoWrap) curX = 0, curY++; else curX--;}}
  97.  
  98. extern void cmputc ();
  99.  
  100. #endif
  101.